<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>注册体验 - 筑为科技</title>
    <!-- 资 源 引 入 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link rel='stylesheet' href='/static/component/layui/css/layui.css'>
    <link rel='stylesheet' href='/static/admin/css/other/login.css'>
    <script src='/static/admin/js/server.js'></script>
    <script src='/static/component/layui/layui.js'></script>
    <script src='/static/component/laytp/layuiConfig.js'></script>
    <script language=javascript src='/static/admin/jsencrypt/jsencrypt.js' charset='utf-8'></script>
</head>
<style>
    #chang{width:1200px;height:550px;background:url('/static/admin/images/chang.png');background-size: 100% 100%;background-repeat:no-repeat;display: none}
    .tops{padding-top: 50px;text-align: center}
    .tops .reg_logo{width: 400px}
    .lefts{float: left;width: 30%;margin: 0 10%}
    .inptit{margin-left: 5px;margin-top: 30px;font-size: 16px;font-weight: bold}
    .layui-form button{
        width: 26% !important;
        height: 44px !important;
        margin-left: 38%;
    }
    .regbut{color: #2272eb;text-align: center;margin-top: 10px;cursor: pointer;margin-left: 10px}
    input::-webkit-input-placeholder{color:#aaa!important;}
    input::-moz-placeholder{color:#aaa!important;}
    input:-moz-placeholder{color:#aaa!important;}
    input:-ms-input-placeholder{color:#aaa!important;}
    #smscode{
        position: absolute;right:5px;top:-17px;text-align: right;color: #2272eb;font-size: 16px;cursor: pointer;
        background-color: unset!important;border: none!important;width: 90px;height: 30px;
    }
    .wenti{text-align: center;margin-top: 18px;color: red}
</style>
<!-- 代 码 结 构 -->
<body style="background:url('/static/admin/images/background.png');background-size: 100%;background-repeat:no-repeat;">

<div id="chang">
    <div class="tops">
        <img class="reg_logo" src="/static/admin/images/reg_logo.png">
    </div>

    <form class="layui-form" lay-filter="layui-form" action="javascript:void(0);" style="width: unset!important;margin-left: unset!important;margin-top: unset!important;">
        <div class="lefts">
            <div id="logsinfo" >
                <div class="inptit">公司名称</div>
                <div class="layui-form-item">
                    <input name="reg_com" placeholder="请输入真实公司名称(必填): " class="layui-input" autocomplete="off"  />
                </div>
                <div class="inptit">您的称呼</div>
                <div class="layui-form-item">
                    <input name="reg_name" placeholder="请输入您的称呼(必填): "  class="layui-input" autocomplete="off" />
                </div>
                <div class="inptit">登录密码</div>
                <div class="layui-form-item">
                    <input type="password" name="pass" placeholder="请输入密码(必填)：不少于6位:" class="layui-input"  />
                </div>
            </div>
        </div>
        <div class="lefts">
            <div id="logsinfo" >
                <div class="inptit">您的部门</div>
                <div class="layui-form-item">
                    <input name="reg_dept" placeholder="请输入您所在公司的部门: " class="layui-input" autocomplete="off" />
                </div>
                <div class="inptit">登录手机号</div>
                <div class="layui-form-item">
                    <input name="tel" id="tel" placeholder="请输入您用于登录的手机号: "   class="layui-input" autocomplete="off"  />
                </div>
                <div class="inptit">手机验证码</div>
                <div class="layui-form-item" style="position: relative">
                    <input type="text" name="code" id="code" placeholder="请输入您收到的手机验证码:"   class="layui-input"  />
                    <button type="button" id="smscode">获取验证码</button>
                </div>


            </div>
        </div>

        <div class="layui-form-item reg-form-item">
            <button type="submit" class="laytp-btn laytp-btn-success operatbut" lay-submit lay-filter="reg">
                提  交
            </button>
            <a href="javascript:void(0)" onclick="get_to_login()"><span class="regbut">已有账号，直接登录 >></span></a>
        </div>

        <div class="wenti">温馨提示：产品顾问将协助您试用产品，并根据您的需求提供专业解决方案！</div>
    </form>
</div>
</body>

<script>
    var param_vision = getQueryVariable('vision') || '';
    function get_to_login(){
        window.location.href = "/login.php?vision="+param_vision;
    }

    layui.use(['laytp','button'], function() {
        var form = layui.form;
        var $ = layui.$;
        var context = layui.context;

        $("#chang").css('margin-top',(document.documentElement.clientHeight-550)/2);
        $("#chang").css('margin-left',(document.documentElement.clientWidth-1200)/2);
        $("#chang").show();




        form.on('submit(reg)', function(data) {
            data.field.vision = param_vision;
            facade.ajax({url: ask_reg, data: data.field}).done(function(res){
                if (res['code'] === 2000) {
                    facade.setCookie('pmlock', 0);
                    window.localStorage.removeItem('pminfo');
                    facade.clearCache();
                    facade.setCookie("token", res.data.token, 7);
                    facade.redirect("/index.php");
                }
            });
            return false;
        });


        // 获取验证码
        $('#smscode').click(function(){
            var tel = $('#tel').val();
            if(tel == ''){
                layer.msg('请填写手机号'); return false;
            }
            if(!check_tel(tel)){
                layer.msg('手机号格式错误'); return false;
            }

            facade.ajax({url: ask_sendsms, data: {tel:tel,type:2}}).done(function(res){
                if(res.code == 2000){
                    send();
                }else{
                    layer.msg(e.message);
                }
            });
        });

        // 倒计时处理
        function send(){
            $('#smscode').attr('disabled','disabled');
            var num = 90;
            setInterval(function(){
                if(num > 0){
                    $('#smscode').text(num+'秒');
                }else{
                    $('#smscode').attr('disabled','false');
                    $('#smscode').text('获取验证码');
                }
                -- num;
            }, 1000);
        }


    });


    // 验证手机号
    function check_tel(tel){
        var rule = /^1[3456789]\d{9}$/;
        return rule.test(tel);
    }

    function getQueryVariable(variable) {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if(pair[0] == variable){return pair[1];}
        }
        return false;
    }
</script>
<script language="javascript" src="https://put.zoosnet.net/JS/LsJS.aspx?siteid=PUT23492095&float=1&lng=cn"></script>
</html>
